# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kwave
pkgver=20.04.3
pkgrel=0
arch="all !armhf !mips !mips64" # armhf blocked by extra-cmake-modules, mips FTBFS
url="http://kwave.sourceforge.net/"
pkgdesc="A sound editor for KDE"
license="GPL-2.0-or-later"
makedepends="extra-cmake-modules qt5-qtbase-dev qt5-qtmultimedia-dev karchive-dev kcompletion-dev kconfig-dev kconfigwidgets-dev kcoreaddons-dev kcrash-dev kdbusaddons-dev kdoctools-dev ki18n-dev kiconthemes-dev kio-dev kservice-dev ktextwidgets-dev kxmlgui-dev kwidgetsaddons-dev audiofile-dev libsamplerate-dev alsa-lib-dev pulseaudio-dev flac-dev opus-dev libvorbis-dev fftw-dev imagemagick"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/kwave-$pkgver.tar.xz"
subpackages="$pkgname-libs $pkgname-doc $pkgname-lang"

build() {

	if [ "$CARCH" = s390x ]; then
		doc_opts="-DWITH_DOC=OFF"
	else
		doc_opts="-DWITH_DOC=ON"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DWITH_OSS=OFF \
		-DWITH_MP3=OFF \
		$doc_opts
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="f57712472ba19695c77904a804c7dd599cc762e7018fed1d16398746156c25832795215d71aa54b143671342db6a1e442f79bfaed491e16657b820e14ac1306d  kwave-20.04.3.tar.xz"
